package chapter04.demo1;
/*
* 1.继承
* 2.重写
* */

class Hero{       //英雄类
    int hp;       //血条
    int mp;       //蓝条
    int length;   //攻击距离
    int move;     //移速
    int speed;    //攻速
    int cs;       //暴击
    public void  action(String downkey){
        if (downkey.equals("Ctrl + 1")){
            System.out.println("嘲讽");
        }
    }
}
class Warrior extends Hero{//战士继承英雄属性

}
class Archer extends Hero{
    //重写
    public void action(String downkey){
        if (downkey.equals("Ctrl + 1")){
            System.out.println("在别的游戏里我可是主角");
    }
        if (downkey.equals("Ctrl + 2")){
            System.out.println("跳舞");
}
    }

public class Demo1 {
    public static void main(String[] args) {
        Warrior jiansheng = new Warrior();
        jiansheng.hp = 645;//给战士赋值初始生命值
        Archer ez = new Archer();
        ez.length = 525;
        ez.action("Ctrl + 1");
    }
}
    }
